package com.ymatou.app.seller.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

public class AddActivity_V1Call extends YmatouBaseCall{
	private static String opurl = "api/activity/CreateActivity_V2";
	
	public AddActivity_V1Call() {
		super(EnvSetup.getSystemUrl("seller_app"), opurl, "POST", "PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		//User-Agent: 02ios====8.4.1=DF50A6A6-0281-44BF-9D60-07412CE57EB1============================2.3.1=appStore========
		client.addHeader("User-Agent", "02ios====8.4.1=DF50A6A6-0281-44BF-9D60-07412CE57EB1============================2.3.1=appStore========");
	}

	/**
	 * 获取Data
	 * 
	 * @return Data
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Data = jo.getJSONObject("Data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}
	
	/**
	 * 获取UserId
	 */
	public int getUserId() {
		int UserId = 0;
		try {
			UserId = getData().getInt("UserId");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return UserId;
	}
	

	/**
	 * 获取AccessToken
	 */
	public String getAccessToken() {
		String AccessToken = null;
		try {
			AccessToken = getData().get("AccessToken").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return AccessToken;
	}
	
	/**
	 * 获取Status
	 */
	public int getStatus(){
		int status=0;
		try {
			status = new JSONObject(getReturnData()).getInt("Status");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return status;	
	}
	
	/**
	 * 获取msg
	 */
	public String  getMsg(){
		String msg=null;
		try {
			msg = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return msg;	
	}

}
